home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_09 / barbu / modaldlg.hpp < prev    next >
C/C++ Source or Header  |  1995-05-11  |  3KB  |  131 lines

  1. Listing4
  2.  
  3. //////// AB CLASSGEN Mon May 01 09:37:31 1995 ////////
  4. // MODALDLG, the letter in the SHOWDATA envelope
  5. //////////////////////////////////////////////////////
  6. #if !defined(MODALDLG_HPP)
  7. #define MODALDLG_HPP
  8. #if !defined(RC_INVOKED)    // no Windows RC compiler
  9. #include "SHOWDATA.HPP"
  10. #include "LINEIN.HPP"
  11. #include "CTL.HPP"
  12.  
  13. class MODALDLG : public CTLMAPPER {
  14. public:
  15.     MODALDLG(SHOWDATA *Guru,
  16.             HWND hWndParent, HINSTANCE hInst,
  17.             const char szDescrFile[],
  18.             const char szDescrSect[],
  19.             const char szResourceType[] = 0
  20.             );
  21.     virtual ~MODALDLG();
  22.  
  23.     CTL* virtualCTLCtor(const DESCRIPT& Desc);
  24.         // overload to have new controls,
  25.         // yet call MODALDLG::'s from derived
  26.  
  27.     SHOWDATA::RET isValid() const { return _valid; }
  28.     SHOWDATA::RET run();
  29.  
  30.     virtual BOOL proc(UINT iMsg, WPARAM wParam,
  31.                         LPARAM lParam);
  32.  
  33.     static const int DUXMARGIN;
  34.     static const int DUYMARGIN;
  35.  
  36.     enum { CTABSIZE = 256 };
  37.  
  38. typedef struct GCTLTag {
  39.     int group;
  40.     CTL * ctl;
  41.     } GCTL;
  42.  
  43. typedef struct GRPXYTag {
  44.     STR name;
  45.     int duwLabel, duhLabel;
  46.     int duwAll, duhAll;
  47.     int duxNext, duyNext;
  48.     } GRPXY;
  49.  
  50. typedef struct DLGHEADERTag {
  51.     long  dtStyle;
  52.     BYTE  dtItemCount;
  53.     int   dtX;
  54.     int   dtY;
  55.     int   dtCX;
  56.     int   dtCY;
  57.     char  dtMenuName[1];
  58.     char  dtClassName[1];
  59.     char  dtCaptionText[1];
  60.     WORD  wPointSize;
  61.     char  szFaceName[14];
  62.     } DLGHEADER;
  63.  
  64. private:
  65.     SHOWDATA *_guru;
  66.     const HINSTANCE _hI;
  67.     const HWND _hP;
  68.     const STR _dsect;
  69.     LINEIN _input;
  70.     DESCRIPT _dlgline;
  71.     MEMBLOCK _template;
  72.     GCTL _ctab[CTABSIZE];
  73.     GRPXY *_pGXY;
  74.     int _ng;
  75.     int _nCtls, _xOffset;
  76.     HWND _hDlg;
  77.     HFONT _hThinFont;
  78.     int _nActiveGroup;
  79.     SHOWDATA::RET _valid;
  80.  
  81. // MODAL0.CPP:
  82.     int _addCtlToDlg(const DESCRIPT& Desc, int xCtl);
  83.         // returns # of added items
  84.  
  85. // MODAL1.CPP:
  86.     static const DLGHEADER _DlgHd;
  87.     static const CTL::DLGITEM _ItemOk;
  88.     static const CTL::DLGITEM _ItemCan;
  89.     static const CTL::DLGITEM _ItemGroup;
  90.     BOOL _initGeometry();
  91.     void _addToGroupGeometry(int nGrp,
  92.                     int duW, int duH);
  93.     void _putTabsAndOKCAN();
  94.  
  95.     virtual int duwText(const char szS[],
  96.                     BOOL bForButton = FALSE) const;
  97.     virtual int duhText() const;
  98.     virtual int duhEdit() const;
  99.     virtual int duhPush() const;
  100.     virtual int duSquareBox() const;
  101.     virtual int duwScreen () const;
  102.     virtual int duhScreen () const;
  103.  
  104. // MODAL2.CPP:
  105.     // The this <---> HWND bijection story:
  106.     static MODALDLG* HWIN2this(HWND hWnd){
  107.             return (MODALDLG*) (MAKELPARAM(
  108.                             GetProp(hWnd, A_LPTR),
  109.                             GetProp(hWnd, A_HPTR)));
  110.                             }
  111.     static const char far A_HPTR[];
  112.     static const char far A_LPTR[];
  113.     static BOOL CALLBACK _export _DlgProc(HWND hWnd,
  114.             UINT iMsg, WPARAM wParam, LPARAM lParam);
  115.     void _forceActiveGroup(int nG);
  116.     void _setActiveGroup(int nG);
  117.     void _endDialog(SHOWDATA::RET Result);
  118.  
  119. //MODAL3.CPP:
  120.     void _thinFontJob();
  121.     void _drawTab(LPDRAWITEMSTRUCT lpDraw);
  122.     void _centerOnScreen();
  123.  
  124. // no body, forbidden use:
  125.     MODALDLG();
  126.     MODALDLG(const MODALDLG&);
  127.     MODALDLG& operator=(const MODALDLG&);
  128. };
  129. #endif
  130. #endif
  131.